package com.jsp.controller; /**
 * @author wzm
 * @create 2023-11-09 16:45
 * project_name:web2310
 * @Description
 */

import com.jsp.pojo.Student;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.annotation.*;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

@WebServlet("/jstl1")
public class JSTLServlet1 extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        doPost(request, response);
    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        List<Student> list = new ArrayList<>();
        list.add(new Student(1,"小明",18,"男","云南昆明",1));
        list.add(new Student(2,"小明1",19,"男","云南昆明",1));
        list.add(new Student(3,"小明2",20,"男","云南昆明",1));
        list.add(new Student(4,"小明3",201,"男","云南昆明",1));

        request.setAttribute("age",25);
        request.setAttribute("stus",list);//存储list
        request.getRequestDispatcher("/jstl01.jsp").forward(request,response);
    }
}
